vulkan: Move push constants into their own header
authorBenjamin Otte <otte@redhat.com>
Tue, 17 Jan 2017 01:20:08 +0000 (02:20 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Jan 2017 05:17:55 +0000 (06:17 +0100)
This is the first step towards easing maintenance of the Vulkan shaders
by moving common code into headers.

32 files changed:
gsk/Makefile.am
gsk/resources/vulkan/blend-clip-rounded.vert.glsl
gsk/resources/vulkan/blend-clip-rounded.vert.spv
gsk/resources/vulkan/blend-clip.vert.glsl
gsk/resources/vulkan/blend-clip.vert.spv
gsk/resources/vulkan/blend.vert.glsl
gsk/resources/vulkan/blend.vert.spv
gsk/resources/vulkan/border-clip-rounded.vert.glsl
gsk/resources/vulkan/border-clip-rounded.vert.spv
gsk/resources/vulkan/border-clip.vert.glsl
gsk/resources/vulkan/border-clip.vert.spv
gsk/resources/vulkan/border.vert.glsl
gsk/resources/vulkan/border.vert.spv
gsk/resources/vulkan/color-clip-rounded.vert.glsl
gsk/resources/vulkan/color-clip-rounded.vert.spv
gsk/resources/vulkan/color-clip.vert.glsl
gsk/resources/vulkan/color-clip.vert.spv
gsk/resources/vulkan/color-matrix-clip-rounded.vert.glsl
gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv
gsk/resources/vulkan/color-matrix-clip.vert.glsl
gsk/resources/vulkan/color-matrix-clip.vert.spv
gsk/resources/vulkan/color-matrix.vert.glsl
gsk/resources/vulkan/color-matrix.vert.spv
gsk/resources/vulkan/color.vert.glsl
gsk/resources/vulkan/color.vert.spv
gsk/resources/vulkan/constants.glsl [new file with mode: 0644]
gsk/resources/vulkan/linear-clip-rounded.vert.glsl
gsk/resources/vulkan/linear-clip-rounded.vert.spv
gsk/resources/vulkan/linear-clip.vert.glsl
gsk/resources/vulkan/linear-clip.vert.spv
gsk/resources/vulkan/linear.vert.glsl
gsk/resources/vulkan/linear.vert.spv

index d665e1d1a269d9d21b3b7a5036b3d967b598bd64..38148452def4c8fe9258100baa39af64a0902d6c 100644 (file)
@@ -58,6 +58,7 @@ gsk_private_vulkan_source_c = \
        gskvulkanrenderpass.c \
        gskvulkanshader.c
 gsk_private_vulkan_include_shaders = \
+       resources/vulkan/constants.glsl \
        resources/vulkan/rounded-rect.glsl
 gsk_private_vulkan_shaders = \
        resources/vulkan/blend-clip.frag.glsl \
index c680c65455f3249d06df4990865f94d866e60ec2..221cbbeebab361211d165b6a6cfb28020e97a782 100644 (file)
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out vec2 outTexCoord;
 layout(location = 2) out flat vec4 outClipBounds;
index 0c27a6b096ec10d331a5197fb9c265f3f9c57b62..2a2d7ce9a408a3ef072cec494aafb9faed33150d 100644 (file)
Binary files a/gsk/resources/vulkan/blend-clip-rounded.vert.spv and b/gsk/resources/vulkan/blend-clip-rounded.vert.spv differ
index 0d66a2dcd7ee001cc59387b4a7b8c5ac297ce264..b1c622bea28ea9df1815277ece1f05e787ff1ad6 100644 (file)
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 
 out gl_PerVertex {
index a12f3c8d9e43d47964644d52069e69f0d1b75ed0..494f9165373308adaa2da2b368609d0bfd8aa489 100644 (file)
Binary files a/gsk/resources/vulkan/blend-clip.vert.spv and b/gsk/resources/vulkan/blend-clip.vert.spv differ
index 30c1474f9c85d01b1197ce45c1403052e7dc33ad..17be8734570cc4d1b94da673a6e76909956ed206 100644 (file)
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 
 out gl_PerVertex {
index dafd915f8c7eb6da168b3c6c2fe155e9717da7d4..962a1b4e18904869424484829444034b01068556 100644 (file)
Binary files a/gsk/resources/vulkan/blend.vert.spv and b/gsk/resources/vulkan/blend.vert.spv differ
index 8939a95d9b6000a7ab813d98dfee12acd37619e1..a66d7f78dc9437745398d73699d446a0e2739dc3 100644 (file)
@@ -1,18 +1,13 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inCornerWidths;
 layout(location = 2) in vec4 inCornerHeights;
 layout(location = 3) in vec4 inBorderWidths;
 layout(location = 4) in mat4 inBorderColors;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outRect;
index 5aae91ae719b6bcfd05d4d145cb34478141f2360..527168616730a55869060d53506ee6fa6095d492 100644 (file)
Binary files a/gsk/resources/vulkan/border-clip-rounded.vert.spv and b/gsk/resources/vulkan/border-clip-rounded.vert.spv differ
index 5de7a12f70d179742ead46aaaeefde4c719aa0e3..8db91a58a4b48ace963eba702f98cf77d604f9d8 100644 (file)
@@ -1,18 +1,13 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inCornerWidths;
 layout(location = 2) in vec4 inCornerHeights;
 layout(location = 3) in vec4 inBorderWidths;
 layout(location = 4) in mat4 inBorderColors;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outRect;
index 5a505d8ebc4bb7d63c66d72da4dad16ab2004b97..ce5e85e3dce516d82e033bb5e2dd1f906e25c462 100644 (file)
Binary files a/gsk/resources/vulkan/border-clip.vert.spv and b/gsk/resources/vulkan/border-clip.vert.spv differ
index 48efbc7e40d7919f1c388a360d3b94d65aa92882..744f5000ef2f2526a250d2d8b69ca2b30a20a69f 100644 (file)
@@ -1,18 +1,13 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inCornerWidths;
 layout(location = 2) in vec4 inCornerHeights;
 layout(location = 3) in vec4 inBorderWidths;
 layout(location = 4) in mat4 inBorderColors;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outRect;
index 384eebeae85d3da07f94bec695a59534439e6b11..6a6cf93865891ea37a906dd086e750db87a14dc2 100644 (file)
Binary files a/gsk/resources/vulkan/border.vert.spv and b/gsk/resources/vulkan/border.vert.spv differ
index a3c55351a291a82a0cbfbaddff5789218de0351c..2303d90e70e53a9a185c023988853d5ee687e080 100644 (file)
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inColor;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out flat vec4 outColor;
 layout(location = 2) out flat vec4 outClipBounds;
index 4414e997dd1c3d516703518f757925920dc3a39b..b28355446742af9ee4540fa8e646452aea568189 100644 (file)
Binary files a/gsk/resources/vulkan/color-clip-rounded.vert.spv and b/gsk/resources/vulkan/color-clip-rounded.vert.spv differ
index b89321759fabf24c1b3e3aea961e2edac767b099..724cee1cdd358f6aa91cb521379cafe9be88c7af 100644 (file)
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inColor;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 out gl_PerVertex {
   vec4 gl_Position;
 };
index 0089004dcfee94df9eed6b52243da7ad42db0413..c07e45f6e3bca643b4b8c76b542dba670237f653 100644 (file)
Binary files a/gsk/resources/vulkan/color-clip.vert.spv and b/gsk/resources/vulkan/color-clip.vert.spv differ
index 2875e637f76e5aaa010fd91af2e5660f70cd61fe..5d3e3400e630c5c9687ca7e51103b0ec86a32656 100644 (file)
@@ -1,17 +1,12 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 layout(location = 2) in mat4 inColorMatrix;
 layout(location = 6) in vec4 inColorOffset;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out vec2 outTexCoord;
 layout(location = 2) out flat vec4 outClipBounds;
index 49271e4572b220e08d7ca1ea87923429cc778fb9..d4db4839d1827fba2b328280bbf9fe0c7eae7a17 100644 (file)
Binary files a/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv and b/gsk/resources/vulkan/color-matrix-clip-rounded.vert.spv differ
index 94d4ef8f9094cc5ff3d4a1391f39f80b02396a78..7f9b77840af7816725a8a60cffc17447abf31faf 100644 (file)
@@ -1,17 +1,12 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 layout(location = 2) in mat4 inColorMatrix;
 layout(location = 6) in vec4 inColorOffset;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 layout(location = 1) out flat mat4 outColorMatrix;
 layout(location = 5) out flat vec4 outColorOffset;
index 6648e245ba0bcfabd4d69739fb13b23353b78d55..84c384622efbb137f4efc0fcb0929b6fe2e9799d 100644 (file)
Binary files a/gsk/resources/vulkan/color-matrix-clip.vert.spv and b/gsk/resources/vulkan/color-matrix-clip.vert.spv differ
index 20b3bbd8d008c1151d1370482ac243b7860005ae..ac1ccc0a54f64fc63b0bb8096e86dbedf1dc2816 100644 (file)
@@ -1,17 +1,12 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inTexRect;
 layout(location = 2) in mat4 inColorMatrix;
 layout(location = 6) in vec4 inColorOffset;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outTexCoord;
 layout(location = 1) out flat mat4 outColorMatrix;
 layout(location = 5) out flat vec4 outColorOffset;
index 2985b7409d2243baadada0bce904d3d12d952ec8..fa89276b21107d266635f7c9d3aa42a87c3ba3f0 100644 (file)
Binary files a/gsk/resources/vulkan/color-matrix.vert.spv and b/gsk/resources/vulkan/color-matrix.vert.spv differ
index 873ccfc949c86667836c56bf04907522a2d05609..ab71cdacb6099e6351dd26324e3cefc5fcf7e7dd 100644 (file)
@@ -1,15 +1,10 @@
 #version 420 core
 
+#include "constants.glsl"
+
 layout(location = 0) in vec4 inRect;
 layout(location = 1) in vec4 inColor;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec4 outColor;
 
 out gl_PerVertex {
index 0d571efc35ac80388d10181e672c6516dcc42641..05d74a6b0b414c2f1816ed2dac6da05d4fbcbb97 100644 (file)
Binary files a/gsk/resources/vulkan/color.vert.spv and b/gsk/resources/vulkan/color.vert.spv differ
diff --git a/gsk/resources/vulkan/constants.glsl b/gsk/resources/vulkan/constants.glsl
new file mode 100644 (file)
index 0000000..427f42b
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef _CONSTANTS_
+#define _CONSTANTS_
+
+layout(push_constant) uniform PushConstants {
+    mat4 mvp;
+    vec4 clip_bounds;
+    vec4 clip_widths;
+    vec4 clip_heights;
+} push;
+
+#endif
index 3426ccef91b3910efa8f686b7f8232de11a3b899..c06021d3cf0dd26fc52d90beedacbe427456d708 100644 (file)
@@ -1,5 +1,7 @@
 #version 420 core
 
+#include "constants.glsl"
+
 struct ColorStop {
   float offset;
   vec4 color;
@@ -21,13 +23,6 @@ layout(location = 12) in vec4 inColors5;
 layout(location = 13) in vec4 inColors6;
 layout(location = 14) in vec4 inColors7;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out vec2 outPos;
 layout(location = 1) out float outGradientPos;
 layout(location = 2) out flat int outRepeating;
index 901fff9ef18230409b4780c37ebefc59c1bef8bd..800e090e916968054bbd1e699d999810082e9892 100644 (file)
Binary files a/gsk/resources/vulkan/linear-clip-rounded.vert.spv and b/gsk/resources/vulkan/linear-clip-rounded.vert.spv differ
index 818d5abf4c9f75734d6ca351c2db01760c06c1fe..4ec7f2ead78b3d7afc760d7b373be735817d07ea 100644 (file)
@@ -1,5 +1,7 @@
 #version 420 core
 
+#include "constants.glsl"
+
 struct ColorStop {
   float offset;
   vec4 color;
@@ -21,13 +23,6 @@ layout(location = 12) in vec4 inColors5;
 layout(location = 13) in vec4 inColors6;
 layout(location = 14) in vec4 inColors7;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out float outGradientPos;
 layout(location = 1) out flat int outRepeating;
 layout(location = 2) out flat int outStopCount;
index 57199f9ec68fe3c87aed43b0a03114bc8df5c3b0..e7d4cf6dac63ab615e347f5b0d5fc4afb2753823 100644 (file)
Binary files a/gsk/resources/vulkan/linear-clip.vert.spv and b/gsk/resources/vulkan/linear-clip.vert.spv differ
index d9d107e2eaea6384a4eb8e80b6699c7ae81666ba..7a55c61380f97e93bf8cd02217c1629427461622 100644 (file)
@@ -1,5 +1,7 @@
 #version 420 core
 
+#include "constants.glsl"
+
 struct ColorStop {
   float offset;
   vec4 color;
@@ -21,13 +23,6 @@ layout(location = 12) in vec4 inColors5;
 layout(location = 13) in vec4 inColors6;
 layout(location = 14) in vec4 inColors7;
 
-layout(push_constant) uniform PushConstants {
-    mat4 mvp;
-    vec4 clip_bounds;
-    vec4 clip_widths;
-    vec4 clip_heights;
-} push;
-
 layout(location = 0) out float outGradientPos;
 layout(location = 1) out flat int outRepeating;
 layout(location = 2) out flat int outStopCount;
index ab3b4ac9a508142d123ea02442a2bb13e8c1e6fb..f2b120f9e65b13e1af2bb55e5ed3d02f59729040 100644 (file)
Binary files a/gsk/resources/vulkan/linear.vert.spv and b/gsk/resources/vulkan/linear.vert.spv differ